#ifndef _cesium_basic_rng_hpp_
#define _cesium_basic_rng_hpp_

namespace Cesium {

template<typename RandomSourceType>
class BasicRNG {
public:
    BasicRNG() {
    }

    BasicRNG(const BasicRNG& cpy)
     : source(cpy.source)
    {
    }

    BasicRNG(const RandomSourceType& src)
     : source(src)
    {
    }

    float32 random() {
        return source.random();
    }

    float32 random(float min, float max) {
        return min + source.random() * (max - min);
    }

    uint32 random(uint32 min, uint32 max) {
        uint32 range = max - min;
        uint32 offset = floorf(source.random() * range);
        // check for the very rare case that the random value was 1.0
        if (offset == range) offset = range - 1;
        return min + offset;
    }

private:
    RandomSourceType source;
}; // class BasicRNG

} // namespace Cesium

#endif //_cesium_basic_rng_hpp_
